package cn.iocoder.yudao.module.shop.dal.mysql.item;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.item.ShopItemDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.item.vo.*;

/**
 * 店铺项目 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface ShopItemMapper extends BaseMapperX<ShopItemDO> {

    default PageResult<ShopItemDO> selectPage(ShopItemPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopItemDO>()
                .likeIfPresent(ShopItemDO::getName, reqVO.getName())
                .betweenIfPresent(ShopItemDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ShopItemDO::getId, reqVO.getId())
                .eqIfPresent(ShopItemDO::getPicUrl, reqVO.getPicUrl())
                .eqIfPresent(ShopItemDO::getTenantId, reqVO.getTenantId())
                .orderByDesc(ShopItemDO::getId));
    }

    default List<ShopItemDO> selectList(ShopItemExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopItemDO>()
                .likeIfPresent(ShopItemDO::getName, reqVO.getName())
                .betweenIfPresent(ShopItemDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ShopItemDO::getId, reqVO.getId())
                .eqIfPresent(ShopItemDO::getPicUrl, reqVO.getPicUrl())
                .orderByDesc(ShopItemDO::getId));
    }

}
